export default {
    data() {
       return {
            share:{
               title: '',
               imageUrl:'',
            },
            shareDetail:{
                title: '',
                imageUrl:'',
            },
            isFirst:true,
       }
    },
    onShareAppMessage(res) { //发送给朋友
			console.log(this.shareDetail.imageUrl,'---------this.share.imageUrl----------')
            return {
                title: this.share.title?this.share.title:this.shareDetail.title,
                imageUrl: this.share.imageUrl?this.share.imageUrl:this.shareDetail.imageUrl,
            }
    },
    // onShareTimeline(res) {//分享到朋友圈
    //     return {
    //         title: this.shareDetail.title,
    //         imageUrl: this.shareDetail.imageUrl,
    //     }
    // },
    onLaunch: function() {
        this.isFirst = false
        let params = {
            page_type:'global'
        }
        setTimeout(() => {
            try {
                uni.$u.api.getConfigDataDetail(params).then(res => {
                    let Detail = res.data
                    this.shareDetail = {
                        title: '',
                        imageUrl: '',
                    }
                    this.shareDetail.title = Detail.content
                    this.shareDetail.imageUrl = Detail.image
                    uni.setStorageSync('shareTitle', Detail.content)
                    uni.setStorageSync('shareImageUrl', Detail.image)
                })
            } catch (error) {}
         }, 3000);

    },
    onLoad() {
        if(this.isFirst){
            this.shareDetail.title  = uni.getStorageSync('shareTitle')
        //     this.shareDetail.imageUrl  = uni.getStorageSync('shareImageUrl')
        }
    },
}
